package com.test.proxy.cglib;
import net.sf.cglib.proxy.Enhancer;
public class Main {
    public static void main(String[] args) {
        //创建代理对象生成器对象
        Enhancer enhancer = new Enhancer();
        //设置父类
        enhancer.setSuperclass(SmsService.class);
        //设置拦截器
        enhancer.setCallback(new MyMethodInterceptor());
        //创建代理对象
        SmsService smsService = (SmsService) enhancer.create();
        SmsService smsService1 = (SmsService) CglibProxyFactory.getProxy(SmsService.class);
        smsService1.send("sssswe");
    }
}